﻿# hello world.py

#(0) for 循环

for n in [1,2,3,4,5,6,7,8,9]:
	print "2 to the %d power is %d" % (n,2**n)

print "\n"
#(1) for

for n in range(1,10):
	print "2 to the %d power is %d" % (n,2**n)
	
print "\n"

# range() 用法
# range(i,j,[步长])
# 例
#      1. a = range(5) [0,1,2,3,4]
#      2. b = range(1,8) [1,2,3,4,5,6,7]
#      3. c = range(0,14,3) [0,3,6,9,12]
#      4. d = range(8,1,-1) [8,7,6,5,4,3,2]
#



# 数值比较大时   用 xrange()

#for n in xrange(10000):
#	print n
#	
#print "\n"


#（2） for  可以拆分打印字符串

a = "Hello World!"

for n in a:
	print n
print "\n"















